<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>管理端提交</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
    <!--<link rel="stylesheet" href="/static/css/public.css">-->
    <script type="application/javascript" src="/static/js/jQuery.js"></script>
    <script type="application/javascript" src="/static/layui/layui.js"></script>
    <script type="application/javascript" src="/static/js/utils.js"></script>
    <style>
        .formBody {
            margin: 30px auto;
            width: 80%;
            height: 90%;
            /*position: absolute;*/
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            -o-box-sizing: border-box;
            box-sizing: border-box;
            background: #fff;
            -webkit-border-radius: 5px;
            -moz-border-radius: 5px;
            border-radius: 5px;
            box-shadow: 0 0 50px #009688;
        }

        .formContext{
            /*margin: 50px 50px 50px 50px;*/
            margin: 0 auto;
            margin-right: 30px;
            padding-top: 30px;
            padding-bottom: 30px;
            /*border: #0C0C0C solid;*/
        }
    </style>
</head>
<body>

    <div class="formBody">
        <div class="formContext">
            <form class="layui-form">
                <div class="layui-form-item">
                    <label class="layui-form-label">姓名</label>
                    <div class="layui-input-inline">
                        <input type="text" name="userName" class="layui-input" />
                    </div>
                    <label class="layui-form-label">联系方式</label>
                    <div class="layui-input-inline">
                        <input type="text" name="loginTel" class="layui-input" />
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">计划事项</label>
                    <div class="layui-input-block">
                        <textarea name="plan" class="layui-textarea" placeholder="请输入内容"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">计划制定</label>
                    <div class="layui-input-inline">
                        <input type="text" name="planTime" class="layui-input" id="planTime">
                    </div>
                    <label class="layui-form-label">计划完成</label>
                    <div class="layui-input-inline">
                        <input type="text" name="doneTime" class="layui-input" id="doneTime">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">是否完成</label>
                    <div class="layui-input-block">
                        <input type="checkbox" name="done" lay-skin="switch" lay-text="是|否">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">实际情况</label>
                    <div class="layui-input-block">
                        <textarea name="context" class="layui-textarea" placeholder="请输入内容"></textarea>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
                    </div>
                </div>
            </form>
        </div>
    </div>

    <script type="application/javascript">

        layui.use(['laydate','form'],function(){
            layui.laydate.render({
                elem: '#planTime' //指定元素
                ,type: 'datetime'
                ,calendar: true //公历节日
            });
            layui.laydate.render({
                elem: '#doneTime' //指定元素
                ,type: 'datetime'
                ,calendar: true
            });

            //监听提交
            layui.form.on('submit(formSubmit)', function(data){

                $.ajax({
                    type: "POST",
                    url: "/adminRest/save",
                    data: data.field,
                    success: function(result){
                        layer.msg(result.msg);
                        var index = parent.layer.getFrameIndex(window.name);//获得index
                        setTimeout(function () {
                            parent.layer.close(index);
                            parent.location.href = "/admin/list";
                        }, 1000);//延迟

                    }
                });

                return false;//阻值表单跳转
            });
        })
    </script>
</body>
</html>